home *** CD-ROM | disk | FTP | other *** search
- // **************************************************************
- // ascii.cpp
- // Example program for Simple C++
- //
- // (c) 1999 Emmenjay Consulting Pty Ltd
- //
- // History
- // 04/06/99 MJS Initial Coding.
- //
- // **************************************************************
-
- #include <iostream>
-
- void PutASCII( int ch )
- {
- std::cout.width( 4 );
- std::cout << ch;
- std::cout.width( 2 );
- std::cout << char(ch)
- << " ";
- }
-
- void PutRow( int ch, int ncol, int offset )
- {
- for (int i=0; i<ncol && ch<127; i++, ch+=offset)
- PutASCII( ch );
- std::cout << '\n';
- }
-
- int main( void )
- {
- int ch;
- int ncol = 6;
- int offset = (127-32+ncol-1)/ncol;
- int last = 32+offset;
-
- for (ch=32; ch<last; ch++)
- PutRow( ch, ncol, offset );
-
- return 0;
- }
-